package com.panfeng.xcloud.common.core.page;

/**
 *
 * 分页公交请求model
 *
 * @author xiaobo
 * @version 1.0
 * @since 2018-12-28
 */
public abstract class PageRequest {

    protected int pageNumber = 1;
    protected int pageSize = 500;

    public PageRequest() {
    }

    public void initPaging(){
        if(this.pageNumber<1){
            this.pageNumber=1;//默认显示第1页
        }
        if(this.pageSize<1||this.pageSize>100){
            this.pageSize=10;//默认显示10行，显示行数[1,100]
        }
    }

    public int getOffset() {
        return (this.pageNumber - 1) * this.pageSize;
    }

    public void setPageNumber(int pageNumber) {
        this.pageNumber = pageNumber;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getPageNumber() {
        return this.pageNumber;
    }

    public int getPageSize() {
        return this.pageSize;
    }
}
